﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ChatDBAccess
{
    public class Login
    {
        public static int LoginChecker(string name, string pass)
        {
            ChatDataClassesDataContext context = new ChatDataClassesDataContext();
            var res =
                (from u in context.Users
                where u.UserName == name && u.PassWord == pass
                select u).FirstOrDefault();

            if (res == null)
            {
                return -1;
            }
            else
            {
                return res.UserId;
            }
        }
    }
}
